<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>审核注册信息</title>
    <link rel="stylesheet" type="text/css" href="assets/global/plugins/select2/select2.css"/>
    <link rel="stylesheet" type="text/css" href="assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"/>
    <link href="assets/global/css/components.css" id="style_components" rel="stylesheet" type="text/css"/>
    <link href="assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
</head>
<link rel="stylesheet" type="text/css" href="../css/dataTables.bootstrap.css" />
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery.min.js"></script>

<style>
    .my_modal{
        /*弹窗css*/
        display: none;
        position: fixed; /*固定位置*/
        z-index: 1; /*弹窗位于顶层*/
        left: 0;
        top: 0;
        width: 88%;
        height: 100%;
        overflow: auto;
        background-color: rgb(0,0,0);
        background-color: rgba(0,0,0,0.4);
    }
    /*弹窗内容*/
    .mymodal-content {
        background-color: #5a6676;
        margin: 15% auto;
        padding: 20px;
        border: 1px solid #888;
        width: 80%;
    }
    .mymodal_close{
    /*关闭弹窗*/
        color: #aaa;
        float: right;
        font-size: 28px;
        font-weight: bold;
    }
    .mymodal_close:hover,
    .mymodal_close:focus{
        color: black;
        text-decoration: none;
        cursor: pointer;
    }

</style>

<body onload="initCheckTable()">
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">用户管理</a></li>
        </ul>
    </div>

    <!--toolBar-->
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li id="addBtn"><img src="../images/t01.png" />添加</li>
                <li id="deleteBtn"><img src="../images/t03.png" />删除</li>
                <li id="modifyBtn"><img src="../images/t02.png" />修改</li>
                <li id="queryBtn"><img src="../images/search.png" />查询</li>

                <li id="exportBtn"><img src="../images/export.png" />导出</li>
                <li id="printBtn"><img src="../images/print.png" />打印</li>
                <li id="sortBtn"><img src="../images/sort.png" />排序</li>
                <li id="staticBtn" onclick="window.location='staticApplyecharts.html'"><img src="../images/t04.png" />统计</li>
            </ul>

        </div>

        <div style="position: relative;width: 88%;">
            <table class="table table-striped table-bordered table-hover datatable" id="record_list">
                <thead>
                <tr>
                    <th class="table-checkbox"><input type="checkbox" class="group-checkable" data-set="#record_list .checkboxes" /></th>
                    <th>申请用户名</th>
                    <th>注册邮箱</th>
                    <th>注册密码</th>
                    <th>注册日期</th>
                    <th>修改/删除</th>
                    <th>审核注册信息</th>
                </tr>
                </thead>
            </table>
        </div>

    </div>

    <!--增加用tip-->
    <div class="row" id="addApplyFrom" style="display: none">
        <div class="col-md-12 " style="width: 88%;left: 6px">
            <!-- BEGIN SAMPLE FORM PORTLET-->
            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption font-green">
                        <i class="icon-pin font-green"></i>
                        <span class="caption-subject bold uppercase" style="width: 200px">添加申请信息</span>
                    </div>

                </div>
                <div class="portlet-body form">
                    <form role="form">
                        <div class="form-body">
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <input type="text" class="form-control" id="inputAccount" value="">
                                <label for="inputAccount">用户名(account)</label>
                                <span class="help-block">请输入需要添加的用户名...</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <input type="text" class="form-control" id="inputEmail">
                                <label for="inputEmail">邮箱(Email)</label>
                                <span class="help-block">请输入邮箱...</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <input type="text" class="form-control" id="inputPassword">
                                <label for="inputPassword">注册密码(password)</label>
                                <span class="help-block">请输入注册密码...</span>
                            </div>

                        </div>
                    </form>
                </div>

                <div class="form-actions noborder">
                    <button type="button" class="btn blue" id="addSubmit">提交</button>
                    <button type="button" class="btn default" id="addCancel">取消</button>
                </div>
                <div style="height: 100px;"></div>
            </div>
        </div>
    </div>

    <!--修改用tip-->
    <div class="row" id="modifyApplyFrom" style="display: none">
        <div class="col-md-12" style="width: 88%;left: 6px">
            <!-- BEGIN SAMPLE FORM PORTLET-->
            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption font-green">
                        <i class="icon-pin font-green"></i>
                        <span class="caption-subject bold uppercase" style="width: 200px">修改申请信息</span>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form role="form">
                        <div class="form-body">
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <label for="modifyApplyAccount">原始注册用户名:<span class="label label-sm label-success"><a style='color: whitesmoke' id="originApplyAccount"></a></span></label>
                                <input type="text" class="form-control" id="modifyApplyAccount" value="">
                                <span class="help-block">请输入需要修改的用户名...如若不需修改，请勿输入！</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <label for="modifyApplyEmail">原始注册邮箱:<span class="label label-sm label-success"><a style='color: whitesmoke' id="originApplyEmail"></a></span></label>
                                <input type="text" class="form-control" id="modifyApplyEmail" value="">
                                <span class="help-block">请输入需要修改的邮箱地址...如若不需修改，请勿输入！</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <label for="modifyApplyPassword">原始注册密码:<span class="label label-sm label-success"><a style='color: whitesmoke' id="originApplyPassword"></a></span></label>
                                <input type="text" class="form-control" id="modifyApplyPassword" value="">
                                <span class="help-block">请输入需要修改的注册密码...如若不需修改，请勿输入！</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <label for="modifyApplyDate">原始注册日期:<span class="label label-sm label-success"><a style='color: whitesmoke' id="originApplyDate"></a></span></label>
                                <input type="date" class="form-control" id="modifyApplyDate" value="">
                                <span class="help-block">请输入需要修改的注册日期...如若不需修改，请勿输入！</span>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="form-actions noborder">
                    <button type="button" class="btn blue" id="modifyApplySubmit">提交</button>
                    <button type="button" class="btn default" id="modifyApplyCancel">取消</button>
                </div>
                <div style="height: 100px;"></div>
            </div>
        </div>
    </div>


    <!--查询信息的 form-->
    <div class="row" id="queryApplyFrom" style="display: none">
        <div class="col-md-12 " style="width: 88%;left: 6px">
            <!-- BEGIN SAMPLE FORM PORTLET-->
            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption font-green">
                        <i class="icon-pin font-green"></i>
                        <span class="caption-subject bold uppercase" style="width: 200px">查询申请注册用户信息</span>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form role="form">
                        <div class="form-body">
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <input type="text" class="form-control" id="queryApplyAccount" value="">
                                <label for="queryApplyAccount">Query Account</label>
                                <span class="help-block">请输入需要查询的申请注册用户名...</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label">
                                <input type="text" class="form-control" id="queryApplyEmail" value="">
                                <label for="queryApplyEmail">Query Email</label>
                                <span class="help-block">请输入需要查询的邮箱...</span>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label has-info" style="width: 48%; left: 0; float: left">
                                <label for="queryStartDate"><span class="label label-sm label-success" style="font-size: 15px">Query Start Date:</span></label>
                                <input type="date" id="queryStartDate" value="" style="font-size: 15px">
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label has-info" style="width: 48%; left: 0; float: left">
                                <label for="queryEndDate"><span class="label label-sm label-success" style="font-size: 15px">Query End Date:</span></label>
                                <input type="date" id="queryEndDate" value="" style="font-size: 15px">
                            </div>
                            <div style="height: 40px"></div>
                            <div class="form-group form-md-line-input form-md-floating-label has-info" style="width: 48%; left: 0; float: left">
                                <select class="form-control edited" id="queryCondition">
                                    <option value="或">或(筛选满足任一条件的记录)</option>
                                    <option value="与" selected>与(筛选出满足所有条件的记录)</option>
                                </select>
                                <label for="queryCondition">Query Condition</label>
                            </div>
                            <div class="form-group form-md-line-input form-md-floating-label has-info" style="width: 48%; float:right;">
                                <select class="form-control edited" id="queryWay">
                                    <option value="模糊查询">模糊查询</option>
                                    <option value="精准查询" selected>精准查询</option>
                                </select>
                                <label for="queryWay">Query Way</label>
                            </div>
                        </div>

                        <div class="form-actions noborder">
                            <button type="button" class="btn blue" id="queryApplySubmit">提交查询</button>
                            <button type="button" class="btn default" id="queryApplyCancel">取消</button>
                        </div>
                        <div style="height: 100px;"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!--导出tip-->
    <!--导出tip-->
    <div class="tip" id="exportApplyInfo">
        <div class="tiptop"><span>导出提示</span><a></a></div>

        <div class="tipinfo">
            <span><img src="../images/tip.png" /></span>
            <div class="tipright">
                <p id="flag"></p>
                <cite><a href="" id="txtDownLoadHref">[点击下载txt]</a></cite>
                <cite><a href="" id="excelDownLoadHref">[点击下载excel]</a></cite>
            </div>
            <div class="tipright">
                <cite><a href="" id="pdfDownLoadHref">[点击下载pdf]</a></cite>
                <cite><a href="" id="csvDownLoadHref">[点击下载csv]</a></cite>
            </div>
        </div>

        <!--tip中的button-->
        <div class="tipbtn">
            <input name="" type="button" style="visibility: hidden" class="sure" value="确定" />
            <input name="" type="button" style="position:relative; left: 40%"  class="sure" value="确定" />
        </div>

    </div>



</body>

<!--引入一些布局和js，可以删除无用的部分-->
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="../js/jquery.uniform.min.js"></script>
<script type="text/javascript" src="../js/jquery.dataTables.min.js"></script>

<script>
    let resultList=[];
    let sort="";
    function initCheckTable(){
        // 全局设置监听
        $(".sure").click(function (){
            $(".tip").fadeOut(100);
        });
        // 2.弹窗的取消
        $(".cancel").click(function (){
            $(".tip").fadeOut(100);
        });
        $(".tiptop a").click(function (){
            $(".tip").fadeOut(100);
        });
        resultList=[];
        $('.datatable').dataTable({
            "destroy":true,
            "paging": true,
            "searching": true,
            "oLanguage": {
                "aria": {
                    "sortAscending": ": activate to sort column ascending",
                    "sortDescending": ": activate to sort column descending"
                },
                "sProcessing": "处理中...",
                "sLengthMenu": "_MENU_ 记录/页",
                "sZeroRecords": "没有匹配的记录",
                "sInfo": "显示第 _START_ 至 _END_ 项记录，共 _TOTAL_ 项",
                "sInfoEmpty": "显示第 0 至 0 项记录，共 0 项",
                "sInfoFiltered": "(由 _MAX_ 项记录过滤)",
                "sInfoPostFix": "",
                "sSearch": "查询:",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "上页",
                    "sNext": "下页",
                    "sLast": "末页"
                }
            },
            "aoColumns": [{
                "mRender": function (data, type, full) {
                    sReturn = '<input type="checkbox" class="checkboxes" value="' + data + '"/>';
                    return sReturn;
                }, "orderable": false
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册用户名
                    sReturn = "<div>"+full.account+"</div>";
                    return sReturn;
                }, "orderable": true
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册邮箱
                    sReturn = "<div>"+full.mail+"</div>";
                    return sReturn;
                }, "orderable": true
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册密码
                    sReturn = "<div>"+full.PASSWORD+"</div>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    // 申请注册日期
                    sReturn = "<div>"+full.applyDate+"</div>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    resultList.push(full);
                    sReturn = "<a href=\"javascript:ModifyApplyShow("+full.Id+")\">【修改记录】</a><a href=\"javascript:delApplyRecord(" + full.Id + ")\">【删除记录】</a>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    sReturn ="<span class='label label-sm label-danger'><a style='color: whitesmoke' href='javascript:refuseApply("+full.Id+")'>拒绝申请</a></span>";
                    sReturn+="<span class='label label-sm label-success'><a style='color: whitesmoke' href='javascript:agreeApply("+full.Id+")'>允许注册</a></span>";
                    return sReturn;
                }, "orderable": true
            }
            ],
            "aLengthMenu": [[5, 10, 15, 20, 25, 40, 50, -1], [5, 10, 15, 20, 25, 40, 50, "所有记录"]],
            "fnDrawCallback": function () {
                $(".checkboxes").uniform();
                $(".group-checkable").uniform();
            },
            "sAjaxSource": "../Login_ServletAction?Action=getApplyRecord&sort="+sort
        });
        $('.datatable').find('.group-checkable').change(function () {
            var set = jQuery(this).attr("data-set");
            var checked = jQuery(this).is(":checked");
            jQuery(set).each(function () {
                if (checked) {
                    $(this).attr("checked", true);
                    $(this).parents('tr').addClass("active");
                } else {
                    $(this).attr("checked", false);
                    $(this).parents('tr').removeClass("active");
                }
            });
            jQuery.uniform.update(set);
        });
        $('.datatable').on('change', 'tbody tr .checkboxes', function () {
            $(this).parents('tr').toggleClass("active");
        });
    }

    // 对添加按钮进行监听
    document.getElementById("addBtn").onclick=function (){
        document.getElementById("modifyApplyFrom").style.display="none";
        document.getElementById("queryApplyFrom").style.display="none";
        document.getElementById("addApplyFrom").style.display="block";
        $("html,body").animate({scrollTop:$("#addApplyFrom").offset().top},1000);
    }

    // 确认添加
    document.getElementById("addSubmit").onclick=function (){
        let message={};
        let url="../Login_ServletAction";
        message.Action="addApplyInfo";
        let account=document.getElementById("inputAccount").value;
        let mail=document.getElementById("inputEmail").value;
        let password=document.getElementById("inputPassword").value;
        if(account=="" || mail=="" || password==""){
            alert("请输入注册完整信息！");
            return;
        }
        message.account=account;
        message.mail=mail;
        message.password=password;
        $.post(url,message,function (json){
            if(json.ok==200){
                alert("添加成功!");
                initCheckTable();
                $("html,body").animate({scrollTop:$("#record_list").offset().top},1000);
            }
        });
    }
    // 取消添加
    document.getElementById("addCancel").onclick=function (){
        document.getElementById("addApplyFrom").style.display="none";
        $("html,body").animate({scrollTop:$("#record_list").offset().top},1000);
    }

    // 修改
    let pos;
    function ModifyApplyShow(id){
        document.getElementById("addApplyFrom").style.display="none";
        document.getElementById("queryApplyFrom").style.display="none";
        for(let i=0;i<resultList.length;i++){
            if(id==resultList[i].Id){
                pos=i;
                document.getElementById("originApplyAccount").innerText=resultList[i].account;
                document.getElementById("originApplyEmail").innerText=resultList[i].mail;
                document.getElementById("originApplyPassword").innerText=resultList[i].PASSWORD;
                document.getElementById("originApplyDate").innerText=resultList[i].applyDate;
            }
        }
        document.getElementById("modifyApplyFrom").style.display="block";
        $("html,body").animate({scrollTop:$("#modifyApplyFrom").offset().top},1000);
    }

    // 提交修改
    document.getElementById("modifyApplySubmit").onclick=function (){
        let url="../Login_ServletAction";
        let message={};
        message.Action="modifyApplyInfo";
        message.id=resultList[pos].Id;
        let account=document.getElementById("modifyApplyAccount").value;
        let mail=document.getElementById("modifyApplyEmail").value;
        let password=document.getElementById("modifyApplyPassword").value;
        // 目前还未做到修改注册日期等信息
        let applyDate=document.getElementById("modifyApplyDate").value;

        if(account=="" && mail=="" && password=="" && applyDate==""){
            alert("请输入需要修改的信息!");
            $("html,body").animate({scrollTop:$("#modifyApplyFrom").offset().top},1000);
            return;
        }else{
            if(account!=""){
                message.account=account;
            }else{
                message.account=resultList[pos].account;
            }
            if(mail!=""){
                message.mail=mail;
            }else{
                message.mail=resultList[pos].mail;
            }
            if(password!=""){
                message.password=password;
            }else {
                message.password=resultList[pos].PASSWORD;
            }
            if(applyDate!=""){
                message.applyDate=applyDate;
            }else{
                message.applyDate=resultList[pos].applyDate;
            }

            $.post(url,message,function (json){
                if(json.ok==200){
                    alert("修改成功!");
                    window.location.reload();
                }else{
                    alert("修改失败!");
                }
            })
        }


    }

    // 取消修改
    document.getElementById("modifyApplyCancel").onclick=function (){
        document.getElementById("modifyApplyFrom").style.display="none";
        $("html,body").animate({scrollTop:$("#record_list").offset().top},1000);
    }

    // 查询
    document.getElementById("queryBtn").onclick=function (){
        document.getElementById("addApplyFrom").style.display="none";
        document.getElementById("modifyApplyFrom").style.display="none";
        document.getElementById("queryApplyFrom").style.display="block";
        $("html,body").animate({scrollTop:$("#queryApplyFrom").offset().top},1000);
    }

    // 提交查询
    document.getElementById("queryApplySubmit").onclick=function (){
        let url="../Login_ServletAction";
        let message={};
        message.Action="queryApplyInfo";
        let account=document.getElementById("queryApplyAccount").value;
        let mail=document.getElementById("queryApplyEmail").value;
        let queryStartDate=document.getElementById("queryStartDate").value;
        let queryEndDate=document.getElementById("queryEndDate").value;
        if(account=="" && mail=="" && queryStartDate=="" && queryEndDate==""){
            alert("请输入查询信息！");
            return;
        }

        message.account=account;
        message.mail=mail;
        message.queryStartDate=queryStartDate;
        message.queryEndDate=queryEndDate;
        // 查询条件 或 与
        message.queryCondition=document.getElementById("queryCondition").value;
        // 查询方式 模糊 精确
        message.queryWay=document.getElementById("queryWay").value;
        initQueryResult(message);
        alert("查询成功!");
        $("html,body").animate({scrollTop:$("#record_list").offset().top},1000);
    }

    // 展示查询结果
    function initQueryResult(message){
        resultList=[];
        $('.datatable').dataTable({
            "destroy":true,
            "paging": true,
            "searching": true,
            "oLanguage": {
                "aria": {
                    "sortAscending": ": activate to sort column ascending",
                    "sortDescending": ": activate to sort column descending"
                },
                "sProcessing": "处理中...",
                "sLengthMenu": "_MENU_ 记录/页",
                "sZeroRecords": "没有匹配的记录",
                "sInfo": "显示第 _START_ 至 _END_ 项记录，共 _TOTAL_ 项",
                "sInfoEmpty": "显示第 0 至 0 项记录，共 0 项",
                "sInfoFiltered": "(由 _MAX_ 项记录过滤)",
                "sInfoPostFix": "",
                "sSearch": "查询:",
                "oPaginate": {
                    "sFirst": "首页",
                    "sPrevious": "上页",
                    "sNext": "下页",
                    "sLast": "末页"
                }
            },
            "aoColumns": [{
                "mRender": function (data, type, full) {
                    console.log(full)
                    sReturn = '<input type="checkbox" class="checkboxes" value="' + data + '"/>';
                    return sReturn;
                }, "orderable": false
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册用户名
                    sReturn = "<div>"+full.account+"</div>";
                    return sReturn;
                }, "orderable": true
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册邮箱
                    sReturn = "<div>"+full.mail+"</div>";
                    return sReturn;
                }, "orderable": true
            }, {
                "mRender": function (data, type, full) {
                    // 申请注册密码
                    sReturn = "<div>"+full.PASSWORD+"</div>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    // 申请注册日期
                    sReturn = "<div>"+full.applyDate+"</div>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    resultList.push(full);
                    sReturn = "<a href=\"javascript:ModifyApplyShow("+full.Id+")\">【修改记录】</a><a href=\"javascript:delApplyRecord(" + full.Id + ")\">【删除记录】</a>";
                    return sReturn;
                }, "orderable": true
            },{
                "mRender": function (data, type, full) {
                    sReturn ="<span class='label label-sm label-danger'><a style='color: whitesmoke' href='javascript:refuseApply("+full.Id+")'>拒绝申请</a></span>";
                    sReturn+="<span class='label label-sm label-success'><a style='color: whitesmoke' href='javascript:agreeApply("+full.Id+")'>允许注册</a></span>";
                    return sReturn;
                }, "orderable": true
            }
            ],
            "aLengthMenu": [[5, 10, 15, 20, 25, 40, 50, -1], [5, 10, 15, 20, 25, 40, 50, "所有记录"]],
            "fnDrawCallback": function () {
                $(".checkboxes").uniform();
                $(".group-checkable").uniform();
            },
            "sAjaxSource": "../Login_ServletAction?Action="+message.Action+"&queryCondition="+message.queryCondition+"&queryWay="+message.queryWay+"&account="+message.account+"&mail="+message.mail+"&queryStartDate="+message.queryStartDate+"&queryEndDate="+message.queryEndDate
        });
        $('.datatable').find('.group-checkable').change(function () {
            var set = jQuery(this).attr("data-set");
            var checked = jQuery(this).is(":checked");
            jQuery(set).each(function () {
                if (checked) {
                    $(this).attr("checked", true);
                    $(this).parents('tr').addClass("active");
                } else {
                    $(this).attr("checked", false);
                    $(this).parents('tr').removeClass("active");
                }
            });
            jQuery.uniform.update(set);
        });
        $('.datatable').on('change', 'tbody tr .checkboxes', function () {
            $(this).parents('tr').toggleClass("active");
        });
    }

    // 取消查询
    document.getElementById("queryApplyCancel").onclick=function (){
       document.getElementById("queryApplyFrom").style.display="none";
       initCheckTable();
        $("html,body").animate({scrollTop:$("#record_list").offset().top},1000);
    }

    // 导出
    document.getElementById("exportBtn").onclick=function() {
        let exportApplyInfo=document.getElementById("exportApplyInfo");
        let message = {};
        let url = "../Login_ServletAction";
        message.Action = "exportFile";
        // 表名
        message.tableName='applyInfo';
        message.tag=Math.random();
        alert("开始导出!")
        $.post(url, message, function (json) {
            console.log(json);
            if (json.ok === 200) {
                // 显示tip
                alert("导出成功!")
                document.getElementById("flag").innerText="导出成功!";
                $("#txtDownLoadHref").attr("href",json.txtDownloadPath);
                $("#excelDownLoadHref").attr("href",json.excelDownloadPath);
                $("#pdfDownLoadHref").attr("href",json.pdfDownloadPath);
                $("#csvDownLoadHref").attr("href",json.csvDownloadPath);
                exportApplyInfo.style.display="block";
            } else {
                tip.style.display="block";
                document.getElementById("flag").innerText="导出失败!";
            }
        });
    }


    // 删除
    function delApplyRecord(id){
        if(confirm("您确定要删除这条记录吗？")){
           if(id>-1) {
               let url = "../Login_ServletAction";
               let message = {};
               message.Action = "deleteInfo";
               message.id = id;
               message.tableName = "applyInfo";
               $.post(url, message, function (json) {
                   if (json.ok == 200) {
                       // 重新加载页面
                       alert("删除成功!");
                       window.location.reload();
                   } else {
                       alert("删除失败，请确定联网，稍后重试!");
                   }
               });
           }
        }
    }

    document.getElementById("printBtn").onclick=function (){
        window.open("printCheckTable.html?sort="+sort)
    }

    // 拒绝用户注册申请
    function refuseApply(id){
        if(confirm("您确定要拒绝该用户的注册申请吗?")){
            let url="../Login_ServletAction";
            let message={};
            message.Action="refuseApply";
            message.id=id;
            $.post(url,message,function (json){
               if(json.ok==200){
                   alert("操作成功!");
                   window.location.reload();
               } else {
                   alert("操作失败!");
               }
            });
        }
    }

    // 允许用户注册申请
    function agreeApply(id){
        if(confirm("您确定要允许该用户的注册申请吗？")){
            let url="../Login_ServletAction";
            let message={};
            message.Action="agreeApply";
            message.id=id;
            $.post(url,message,function (json){
                if(json.ok==200){
                    alert("操作成功!");
                    window.location.reload();
                }else {
                    alert("操作失败!");
                }
            });
        }
    }
</script>
</html>